class Solution {
public:
    int brokenCalc(int startValue, int target) {
        int ret=0;
        while(target!=startValue)
        {

            if(target>startValue)
            {
                if(target%2==0)
                {
                    target/=2;
                    ret++;
                }
                else
                {
                    target+=1;
                    ret++;
                }
            }
            else if(target<startValue)
            {
                target+=1;
                ret++;
            }
            else
            {
                return ret;
            }
        }
        return ret;
    }
};